﻿using Microsoft.EntityFrameworkCore;
using SaaS.Model.Entity.Sites;
using SaaS.Model.Entity.Gateways;
using SaaS.Model.Entity.Auths;
using SaaS.Model.Entity.Blogs;
using SaaS.Model.Entity.Systems;
using SaaS.Core;

namespace Web.System.Utils
{
    public class SystemDbContext : DbContext
    {
        public SystemDbContext(DbContextOptions<SystemDbContext> options) : base(options)
        {

        }
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlServer(CoreSetting.DefaultConnectionString);
            base.OnConfiguring(optionsBuilder);
        }
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
        }
        #region Auth相关表

        public DbSet<DataPermission> DataPermissions { get; set; }
        public DbSet<OrganizationUnit> OrganizationUnits { get; set; }
        public DbSet<Menu> Menus { get; set; }


        #endregion

        #region 站点 相关表
        public DbSet<Site> Sites { get; set; }
        public DbSet<Project> Projects { get; set; }
        public DbSet<ProjectDetail> ProjectDetails { get; set; }
        public DbSet<ProjectPermission> ProjectPermissions { get; set; }
        public DbSet<Order> Orders { get; set; }
        public DbSet<Operation> Operations { get; set; }
        #endregion

        #region 门户 相关表
        public DbSet<Notice> Notices { get; set; }
        public DbSet<Basics> Basics { get; set; }

        #endregion

        #region 博客 相关表
        /// <summary>
        /// 文章表
        /// </summary>
        public DbSet<Article> Articles { get; set; }
        /// <summary>
        /// 文章标记
        /// </summary>
        public DbSet<ArticleTag> ArticleTags { get; set; }
        /// <summary>
        /// 文章留言板
        /// </summary>
        public DbSet<ArticleMessage> ArticleMessages { get; set; }
        /// <summary>
        /// 文章版本
        /// </summary>
        public DbSet<ArticleVersions> ArticleVersions { get; set; }
        /// <summary>
        /// 博客菜单
        /// </summary>
        public DbSet<BlogMenu> BlogMenus { get; set; }
        #endregion

        #region 系统 相关表
        public DbSet<SystemAdmin> SystemAdmins { get; set; }
        public DbSet<SystemRole> SystemRoles { get; set; }
        public DbSet<SystemAdminLog> SystemAdminLogs { get; set; }
        public DbSet<SystemSetting> SystemSettings { get; set; }
        #endregion

    }
}
